package com.cssy.xxkj.logic.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicOutsideBoundDAO;
import com.cssy.xxkj.logic.entity.LogicOutsideBoundDO;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-10-14
 */
public class LogicOutsideBoundDAOImpl extends SqlMapClientDaoSupport implements LogicOutsideBoundDAO {

    /**
     * 插入数据
     * @param logicOutsideBoundDO
     * @return 插入数据的主键
     */
    public String insertLogicOutsideBoundDO(LogicOutsideBoundDO logicOutsideBoundDO) {
        Object id = getSqlMapClientTemplate().insert("LogicOutsideBound.insert", logicOutsideBoundDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicOutsideBoundDO
     * @return 查出的记录数
     */
    public Integer countLogicOutsideBoundDOByExample(LogicOutsideBoundDO logicOutsideBoundDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicOutsideBound.countByDOExample", logicOutsideBoundDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicOutsideBoundDO
     * @return 受影响的行数
     */
    public Integer updateLogicOutsideBoundDO(LogicOutsideBoundDO logicOutsideBoundDO) {
        int result = getSqlMapClientTemplate().update("LogicOutsideBound.update", logicOutsideBoundDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicOutsideBoundDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicOutsideBoundDO> findListByExample(LogicOutsideBoundDO logicOutsideBoundDO) {
        List<LogicOutsideBoundDO> list = getSqlMapClientTemplate().queryForList("LogicOutsideBound.findListByDO", logicOutsideBoundDO);
        return list;
    }

    /**
     * 根据主键获取logicOutsideBoundDO
     * @param id
     * @return logicOutsideBoundDO
     */
    public LogicOutsideBoundDO findLogicOutsideBoundDOByPrimaryKey(String id) {
        LogicOutsideBoundDO logicOutsideBoundDO = (LogicOutsideBoundDO) getSqlMapClientTemplate().queryForObject("LogicOutsideBound.findByPrimaryKey", id);
        return logicOutsideBoundDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicOutsideBoundDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicOutsideBound.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicOutsideBoundDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicOutsideBoundDO> list = getSqlMapClientTemplate().queryForList("LogicOutsideBound_ex.find", scs);
		return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer row =  (Integer)getSqlMapClientTemplate().queryForObject("LogicOutsideBound_ex.count", scs);
		return row;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer row = (Integer)getSqlMapClientTemplate().queryForObject("LogicOutsideBound_ex.deleteBizRemoved", id);
		return row;
	}

}